
package com.git.service;

import java.io.File;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import javax.xml.namespace.QName;

import com.allfirst.service.LimitsService;
import com.allfirst.service.LimitsService_Service;
import com.allfirst.service.param.ObjectFactory;
import com.allfirst.service.param.LimitsServiceRequest;
import com.allfirst.service.param.LimitsServiceResponse;


public final class LimitsServiceClient {

    private static final QName SERVICE_NAME = new QName("http://service.allfirst.com/", "LimitsService");
    private static ObjectFactory factory = new ObjectFactory();
    
    private LimitsServiceClient() {
    }

    public static void main(String args[]) throws java.lang.Exception {
        URL wsdlURL = LimitsService_Service.WSDL_LOCATION;
        if (args.length > 0 && args[0] != null && !"".equals(args[0])) { 
            File wsdlFile = new File(args[0]);
            try {
                if (wsdlFile.exists()) {
                    wsdlURL = wsdlFile.toURI().toURL();
                } else {
                    wsdlURL = new URL(args[0]);
                }
            } catch (MalformedURLException e) {
                e.printStackTrace();
            }
        }
        LimitsService_Service ss = new LimitsService_Service(wsdlURL, SERVICE_NAME);
        LimitsService port = ss.getLimitsServiceImplPort();  
        
        System.out.println("Invoking getLimits...");
        LimitsServiceRequest request = factory.createLimitsServiceRequest();
        request.setSessionId(java.net.URLEncoder.encode("4CAD32952221CCEBB02755DF813A384D", "utf-8"));
        request.setFunctionId(java.net.URLEncoder.encode("0", "utf-8"));
        LimitsServiceRequest _getLimits_parameters = request;
        LimitsServiceResponse _getLimits__return = port.getLimits(_getLimits_parameters);
        System.out.println("getLimits.result=" + _getLimits__return);

        System.exit(0);
    }
    
    public static LimitsServiceResponse getLimitsService(String SessionId,String FunctionId) throws Exception{
        URL wsdlURL = LimitsService_Service.WSDL_LOCATION;
       
        LimitsService_Service ss = new LimitsService_Service(wsdlURL, SERVICE_NAME);
        LimitsService port = ss.getLimitsServiceImplPort();  
        
        System.out.println("Invoking getLimits...");
        LimitsServiceRequest request = factory.createLimitsServiceRequest();
        request.setSessionId(java.net.URLEncoder.encode(SessionId, "utf-8"));
        request.setFunctionId(java.net.URLEncoder.encode(FunctionId, "utf-8"));
        LimitsServiceRequest _getLimits_parameters = request;
        LimitsServiceResponse _getLimits__return = port.getLimits(_getLimits_parameters);
        System.out.println("getLimits.result=" + _getLimits__return);
       
        return _getLimits__return;
    }
}
